/**
 * Copyright (C), 2015-2021, 开度
 * FileName: UserInfoDto
 * Author:   ASUS
 * Date:     2021/4/29 13:59
 * Description: 用户登录返回实体vo
 * History:
 * <author>          <time>          <version>          <desc>
 * Hezeyu           2021/4/29           1.0              用户登录返回实体vo
 */
package com.example.spring.security.dto;

import com.example.spring.security.pojo.MenuInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * 〈用户登录返回实体vo〉
 *
 * @author ASUS
 * @create 2021/4/29
 * @since 1.0.0
 */
@Slf4j
@ApiModel(value = "用户返回实体",description = "用户登录返回实体")
public class UserInfoDto extends User implements Serializable {

    @ApiModelProperty(value = "用户名",name = "userName")
    private String userName;

    @ApiModelProperty(value = "角色",name = "role")
    private String role;

    @ApiModelProperty(value = "菜单列表",name = "menuInfos")
    private List<MenuInfo> menuInfos;

    @ApiModelProperty(value = "token",name = "token")
    private String token;

    public UserInfoDto(String username, String password, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, authorities);
    }

    public UserInfoDto(String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public List<MenuInfo> getMenuInfos() {
        return menuInfos;
    }

    public void setMenuInfos(List<MenuInfo> menuInfos) {
        this.menuInfos = menuInfos;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public static Logger getLog() {
        return log;
    }
}
